package openbang.account.service.intf;


import java.util.List;

import openbang.account.service.entity.DiaoChaProject;
import openbang.account.service.vo.DiaoChaItemRate;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

/**
 * 调查服务
 * @author aibo zeng
 *
 */

@RemoteServiceRelativePath("diaoChaService")
public interface DiaoChaService extends RemoteService{
	
	/**
	 * 取出调查项在界面上显示
	 * 从缓存中取出调查子项的定义
	 * @param code
	 * @return
	 */
	public DiaoChaProject getProject(String code);
	
	/**
	 * 用户提交一次调查
	 * @param projectId
	 * @param selectItemId
	 * @return List<DiaoChaItemRate> 调查结果（百分比）
	 */
	public List<DiaoChaItemRate> addDiaoChaRecord(Long projectId, Long selectItemId );
	
    /* @RemoteServiceRelativePath相当于以下用法
     */
    public static class Util {
		private static DiaoChaServiceAsync instance;
		public static DiaoChaServiceAsync getInstance(){
			if (instance == null) {
				instance = (DiaoChaServiceAsync) GWT.create(DiaoChaService.class);
				ServiceDefTarget target = (ServiceDefTarget) instance;
				target.setServiceEntryPoint("/diaoChaService");//GWT.getModuleBaseURL() 
			}
			return instance;
		}
	} 
	   //diaoChaService 必须在 web.xml中声明	
}
